function Collect_hom_FEdemoshrt_grID_wtp_tomlab_varagin_j_bs(subsample,inc,set_seed)

	tmp_file1=strcat('\\c3\rdat\SHoude\Research/sears/estar_data\refrigerators\choiceset_identifier_trimester_week_zipcode_2008_2012_v11022017_struct_',num2str(subsample),'_',num2str(inc),'_seed_',num2str(set_seed),'.csv');
    id=load(tmp_file1); 
	Nmax=size(id,1);
	bs_max=10*ceil(Nmax/10000);

	c=1;
for j=1:bs_max	
   
try
	index_bs=[(1+(j-1)*(1000)):min(j*(1000),Nmax)];
    tmp_file1=strcat('\\c3\rdat\SHoude\Research/sears/estar_data\refrigerators\choiceset_identifier_trimester_week_zipcode_2008_2012_v11022017_struct_',num2str(subsample),'_',num2str(inc),'_seed_',num2str(set_seed),'.csv');
    id=load(tmp_file1);
    id=id(index_bs,:);
    id(:,1:7)=[];
    choicest_size=sum(id,2);
    %id_discard=find(choicest_size>200 | choicest_size<50);
    id_discard=find(choicest_size>400);
    id(id_discard,:)=[];  
    choicest_size(id_discard)=[]; 
    id=id';
    [id_i,id_j,id_s]=find(id);
    id_ij=find(id);
    [id_m,id_n] = size(id);
    
    J=size(id,1);
   
	results_file=strcat('\\c3\rdat\SHoude\Research/sears/estar_results/struct_est/','hom_FEdemoshrt_wtp_LLC_5_18_',num2str(subsample),'_inc',num2str(inc),'_sd',num2str(set_seed),'_04132018_bs_',num2str(j),'.mat');
    
	clogit=load(results_file);
 
    eta(c)=clogit.theta_est1(J);
    tau(c)=clogit.theta_est1(J+1);
    pi(c)=clogit.theta_est1(J+2);
    theta(c)=clogit.theta_est1(J+3);
    c=c+1;

catch
 c=c;
end 
 
end


colNames = {'eta','theta','tau','pi'};
Table_beta = [eta',theta',tau',pi'];
Table_beta_n = array2table(Table_beta,'VariableNames',colNames);
			
results_all=strcat('\\c3\rdat\SHoude\Research/sears/estar_results/struct_est/','clogit_FEdemoshrt_grID_wtp_100iters_',num2str(subsample),'_',num2str(inc),'_',num2str(set_seed),'_matlab_seed_',num2str(matlab_seed),'_nb_draws_',num2str(get_nb_draws),'all_bs','.csv');
    
writetable(Table_beta_n,results_all);

end

